<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>

    <style>
        body {
            margin: 0;
            overflow: hidden;
        }
    </style>
</head>
<body>

<script src="../lib/three.js"></script>
<script>
    const scene = new THREE.Scene()

    const geometry = new THREE.BufferGeometry()
    const vertices = new Float32Array([
        0, 0, 0, // 顶点1坐标
        50, 0, 0, // 顶点2坐标
        0, 100, 0, // 顶点3坐标
        0, 0, 10, // 顶点4坐标
        0, 0, 100, // 顶点5坐标
        50, 0, 10, // 顶点6坐标
    ])
    geometry.attributes.position = new THREE.BufferAttribute(vertices, 3);

    /*(() => {
        const material = new THREE.MeshBasicMaterial({
            color: 0x0000ff,
            side: THREE.DoubleSide, // 两面可见
        })
        const mesh = new THREE.Mesh(geometry, material)
        scene.add(mesh)
    })();*/

    (() => {
        const material = new THREE.MeshBasicMaterial({
            color: 0xff0000,
            side: 10.0,
        })
        const points = new THREE.Points(geometry, material)
        scene.add(points)
    })();

    (() => {
        const material = new THREE.LineBasicMaterial({
            color: 0xff0000,
        })
        const line = new THREE.Line(geometry, material)
        scene.add(line)
    })()

    const width = window.innerWidth
    const height = window.innerHeight
    const k = width / height
    const s = 300
    const camera = new THREE.OrthographicCamera(-s * k, s * k, s, -s, 1, 1000)
    camera.position.set(250, 300, 200)
    camera.lookAt(scene.position)

    const renderer = new THREE.WebGLRenderer()
    renderer.setSize(width, height)
    renderer.setClearColor(0xb9d3ff, 1)
    document.body.appendChild(renderer.domElement)

    renderer.render(scene, camera)
</script>
</body>
</html>
